home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
et
/
et3_0-a1.lha
/
et3
/
src
/
ObjInt.C
< prev
next >
Wrap
C/C++ Source or Header
|
1992-04-27
|
703b
|
46 lines
#ifdef __GNUG__
#pragma implementation
#endif
#include "ObjInt.h"
#include "Class.h"
#include "String.h"
NewMetaImpl(ObjInt,Object, (T(val)));
//---- an integer object -------------------------------------------------------
unsigned long ObjInt::Hash()
{
return (u_long) val;
}
bool ObjInt::IsEqual(Object* op)
{
return op->IsKindOf(ObjInt) && val == ((ObjInt*)op)->val;
}
int ObjInt::Compare(Object* op)
{
return val - Guard(op, ObjInt)->val;
}
char* ObjInt::AsString()
{
return form("%d", val);
}
OStream& ObjInt::PrintOn(OStream &s)
{
Object::PrintOn(s);
return s << val SP;
}
IStream& ObjInt::ReadFrom(IStream &s)
{
Object::ReadFrom(s);
return s >> val;
}